cmake_minimum_required(VERSION 3.22.1)
project(cpp_multi_threads)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 添加当前目录到包含路径
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

# 添加多个子目录，每个子目录是独立的demo（按照我学习的顺序来排序）
add_subdirectory(simplest_sample)
add_subdirectory(sample)
add_subdirectory(detach)
add_subdirectory(is_worker_running)
add_subdirectory(joinable)
add_subdirectory(thread_id)
add_subdirectory(call_object_and_member_function)
add_subdirectory(construct_to_thread)
add_subdirectory(lambda)
add_subdirectory(pass_alive_para)
add_subdirectory(real_reference)
add_subdirectory(mutex)
add_subdirectory(dead_lock)
add_subdirectory(lock_guard)
add_subdirectory(unique_lock)

#add_subdirectory(share_data)
add_subdirectory(condition_variable)


add_subdirectory(async)
add_subdirectory(packaged_task)
add_subdirectory(promise)
add_subdirectory(future_supplement)  # 前面3个知识点（async, packaged_task, promise）提到future，但是没说全，这里作为补充
add_subdirectory(shared_future)

add_subdirectory(atomic)

add_subdirectory(compile_fail)

add_subdirectory(Windows_CRITICAL_SECTION)  # 临界区（仅限 Windows 平台）
add_subdirectory(Windows_CS_RAII)           # RAII 方式使用临界区（仅限 Windows 平台）

add_subdirectory(recursive_mutex)
add_subdirectory(timed_mutex)

#add_subdirectory(call_once)  # 补充：知识点 std::call_once() 请看 Singleton_Pattern 工程（单例模式）

